﻿using System.Security.Cryptography;
using System.Text;

namespace PLCSharp.Services
{
    public class EncryptService
    {
        /// <summary>
        /// MD5加密(32位)
        /// </summary>
        /// <param name="str">加密字符</param>
        /// <returns></returns>
        public static string Encrypt(string str)
        {
            if (str == null) return "";
            byte[] hash = MD5.HashData(Encoding.UTF8.GetBytes(str));
            return Convert.ToBase64String(hash);
        }
    }
}